/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef Timer8bits2OCR_H_
#define Timer8bits2OCR_H_

//#include "../Utils/CppExtensions.h"
//#include "../Utils/BitManipulation.h"
#include "Prescalers.h"
#include "TimerOutputCompareModes.h"
#include "TimerWaveGenerationModes.h"
#include "Counter.h"
#include "Comparator.h"

namespace Timers
{

class Timer8bits2OCR
{
public:
	virtual ~Timer8bits2OCR();

	static Timer8bits2OCR * getTimer8bits2OCR(size_t number);

	inline void setWaveGenerationMode(uint8_t wgm2, uint8_t wgm1, uint8_t wgm0) FORCE_INLINE;

	inline Counter8 * getCounter() FORCE_INLINE;

	inline Comparator8 * getComparatorA() FORCE_INLINE;

	inline Comparator8 * getComparatorB() FORCE_INLINE;

protected:

	Timer8bits2OCR(IOAddress tccra, uint8_t comaMask, uint8_t combMask, uint8_t wgmLSBMask,
			IOAddress tccrb, uint8_t wgmMSB, uint8_t csMask,
			IOAddress tcnt, IOAddress ocra, IOAddress ocrb,
			IOAddress timsk, uint8_t toie, uint8_t toieCallbackVectorNumber, uint8_t ociea, uint8_t ocieaCallbackVectorNumber, uint8_t ocieb, uint8_t ociebCallbackVectorNumber,
			IOAddress tifr, uint8_t tov, uint8_t ocfa, uint8_t ocfb);




	IOAddress tccra;
	IOAddress tccrb;

	IOAddress timsk;
	uint8_t icie;

	IOAddress tifr;
	uint8_t icf;

	Counter8 counter;

	Comparator8 comparatorA;
	Comparator8 comparatorB;
};

#include "Timer8bits2OCR-definitions.h"

}

#endif /* Timer8bits2OCR_H_ */
